<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Merchant extends Model
{
    use HasFactory;

    protected $table = 'ims_yh_merchant';
    public $timestamps = false; // 表使用 created_at(int) 和 updated_at(datetime)

    protected $fillable = [
        'name',
        'code',
        'tax_number',
        'mobile',
        'area_id',
        'full_areaname',
        'address',
        'balance',
        'status',
    ];

    protected $casts = [
        'balance' => 'integer',
        'status' => 'integer',
        'created_at' => 'integer',
    ];

    public function admins()
    {
        return $this->hasMany(\App\Models\Merchant\MerchantAdmin::class, 'merchant_id', 'id');
    }
}
